<!-- categories -->
<div class="categ_container">
    <div class="categ_title">Categories:</div>
    <?php foreach ($category_link as $id => $link) : ?>
        <a onclick="navigateThumbnail(this);" <?php if (isset($link['active'])) { ?> class="active" <?php } ?> href="<?php echo URL::site($pagination_url . $id) ?>"><?php echo $link['value'] ?></a>
    <?php endforeach; ?>
</div>

<!-- thumbnails wrapper-->
<div class="photo_thumbnails_wrapper">
<?php foreach ($photos as $p) : ?>
        <div class="photo_thumbnail">
        <?php
            $view_par = "?uid=" . $p["user"]["id"];
            if (isset($auth_user) && $auth_user->id == $p["photo"]["owner"]) {
                $view_par = "";
            }
        ?>
            <a href="<?php
            if ($tagged_category) {
                $view_par = "?uid=" . $p["photo"]["owner"];
            }
            echo URL::site('photo/view/' . $p['photo']['category_id'] . '/' . $p['photo']['id'] . $view_par);
        ?>">
                <img title="<?php echo $p['photo']['description']; ?>" class="thumb" alt="thumbnail" src="<?php echo URL::base_url() . $p['photo']['link'] ?>" />
         </a>
         <div class="uploader_name"><?php echo $p['user']['username']; ?></div>
         <div class="categ_name"><?php echo $p['photo_category']['name']; ?></div>
     </div>
<?php endforeach; ?>

     <!-- Prev Next -->
     <div class="prev_next">
<?php if ($page - 1 > 0) : ?>
                    <div class="prevbutton">
                        <a onclick="navigateThumbnail(this);" href="<?php echo URL::site($pagination_url . "$category_id/" . ($page - 1) . $get); ?>">
                        <img src="<?php echo URL::base_url() . '/public/image/left.png' ?>" alt="Prev"/>
                    </a>
                </div>
<?php endif; ?>
        <?php if ($page + 1 <= $max_page) : ?>
                    <div class="nextbutton">
                        <a onclick="navigateThumbnail(this);" href="<?php echo URL::site($pagination_url . "$category_id/" . ($page + 1) . $get); ?>">
                            <img src="<?php echo URL::base_url() . '/public/image/right.png' ?>" alt="Prev"/>
                        </a>
                    </div>
<?php endif; ?>
    </div>
</div>